package org.hertsig.legality;

import java.util.Set;

import org.hertsig.legality.LegalityChecker.Conflict.Type;

import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multiset;

class CommanderLegalityChecker extends LegalityChecker {
	private final Set<String> bannedCommanders;
	
	CommanderLegalityChecker() {
		super("Commander", parse("banlist/commander-banned.txt"), ImmutableSet.<String>of());
		bannedCommanders = parse("banlist/commander-banned-as-commander.txt");
		setMinDeckSize(100);
		setMaxPerCard(1);
	}
	
	@Override
	protected void check(Multiset<String> cards, ImmutableSet.Builder<Conflict> builder) {
		super.check(cards, builder);
		for (String card : cards) {
			if (bannedCommanders.contains(card)) {
				builder.add(new Conflict(Type.OTHER, card + " is banned as commander, but legal to play", "Commander"));
			}
		}
	}
}
